Skip to content

Abort compile tasks and associated subprocesses when a client disconnects - #2761

Merged
sylvestre merged 1 commit into
mozilla:mainfrom
trxcllnt:fix/kill-task-subprocs
Jul 21, 2026
Merged

Abort compile tasks and associated subprocesses when a client disconnects#2761
sylvestre merged 1 commit into
mozilla:mainfrom
trxcllnt:fix/kill-task-subprocs

Conversation

@trxcllnt

@trxcllnt trxcllnt commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

If an sccache client disconnects from the server before the request completes, abort the tokio tasks spawned to handle the request. Uses tokio::process::Command::kill_on_drop() to ensure the task's pending subprocesses are also killed.

I've added an extra level of nesting and allowed clippy::redundant_async_block to aid in review, otherwise the diff is dominated by whitespace changes related to un-indenting the body of start_compile_task. I can push a new commit with the redundant async block removed once this PR is approved.

Fixes #2759

@codecov-commenter

codecov-commenter commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.55556% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.15%. Comparing base (68cd330) to head (27a7542).

Files with missing lines Patch % Lines
src/server.rs 74.07% 14 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2761      +/-   ##
==========================================
- Coverage   74.18%   74.15%   -0.03%     
==========================================
  Files          71       71              
  Lines       40491    40537      +46     
==========================================
+ Hits        30037    30062      +25     
- Misses      10454    10475      +21     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sylvestre
sylvestre merged commit 7cd4f2c into mozilla:main Jul 21, 2026
51 checks passed
@trxcllnt
trxcllnt deleted the fix/kill-task-subprocs branch July 21, 2026 16:01
lkwilson pushed a commit to lkwilson/red that referenced this pull request Jul 30, 2026
This PR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [mozilla/sccache](https://github.com/mozilla/sccache) | minor | `0.16.0` → `0.17.0` |

---

### Release Notes

<details>
<summary>mozilla/sccache (mozilla/sccache)</summary>

### [`v0.17.0`](https://github.com/mozilla/sccache/releases/tag/v0.17.0)

[Compare Source](mozilla/sccache@v0.16.0...v0.17.0)

##### sccache 0.17.0

##### Summary

sccache 0.17.0 is a significant release: it introduces a **new client-side architecture**.

Until now, every compilation was handed off to the long-lived sccache server, which did the cache
lookup and ran the compiler. In client-side mode, the client process does that work itself - the
server is only consulted for the shared state it owns (compiler info, dist client, stats). This
removes a round-trip and the server-side bottleneck, and gives noticeably better results on
developer workstations.

Client-side mode is opt-in for now: enable it with the `SCCACHE_CLIENT_SIDE` environment variable
(or the `client_side_mode` config key). See [docs/Architecture.md](https://github.com/mozilla/sccache/blob/main/docs/Architecture.md#client-side-mode-sccache_client_side)
for the details.

Other highlights:

- **Response files**: gcc/clang builds using quoted `@response` files are now cached and
  distributed correctly ([#&#8203;2755](mozilla/sccache#2755), [#&#8203;2772](mozilla/sccache#2772)), and Rust `@argfile` arguments are supported ([#&#8203;2782](mozilla/sccache#2782)).
- **Distributed compilation**: compile tasks and their subprocesses are now aborted when a client
  disconnects, instead of running to completion on the build server ([#&#8203;2761](mozilla/sccache#2761), [#&#8203;2774](mozilla/sccache#2774)). The
  `ToolchainPackager` cfg gate was fixed so the dist code builds on ppc64le and s390x ([#&#8203;2749](mozilla/sccache#2749)).
- **S3 SSE-KMS**: server-side encryption with KMS keys is now supported ([#&#8203;2770](mozilla/sccache#2770)).
- **Diagnostics**: gcc color diagnostics now behave the same way as rustc's ([#&#8203;2758](mozilla/sccache#2758)).
- **Preprocessor correctness**: `-ivfsoverlay` is treated as a preprocessor-only argument ([#&#8203;2767](mozilla/sccache#2767)).

Welcome to 4 new contributors!

##### Client-side mode

- Initial client-side implementation by [@&#8203;glandium](https://github.com/glandium) in [#&#8203;2735](mozilla/sccache#2735)
- doc: document client-side and direct modes in Architecture.md by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2752](mozilla/sccache#2752)

##### Features

- gcc/clang: cache and distribute builds using quoted [@&#8203;response](https://github.com/response) files by [@&#8203;avikivity](https://github.com/avikivity) in [#&#8203;2755](mozilla/sccache#2755)
- Add support for arg files in Rust by [@&#8203;ranger-ross](https://github.com/ranger-ross) in [#&#8203;2782](mozilla/sccache#2782)
- feat: support S3 SSE-KMS by [@&#8203;jpadilla](https://github.com/jpadilla) in [#&#8203;2770](mozilla/sccache#2770)
- Make gcc diagnostics color output work the same as for rustc by [@&#8203;jwidauer](https://github.com/jwidauer) in [#&#8203;2758](mozilla/sccache#2758)
- Abort compile tasks and associated subprocesses when a client disconnects by [@&#8203;trxcllnt](https://github.com/trxcllnt) in [#&#8203;2761](mozilla/sccache#2761)

##### Fixes

- Fix ToolchainPackager cfg gate to build on ppc64le/s390x by [@&#8203;cryptomilk](https://github.com/cryptomilk) in [#&#8203;2749](mozilla/sccache#2749)
- treat -ivfsoverlay as a preprocessor-only argument by [@&#8203;glandium](https://github.com/glandium) in [#&#8203;2767](mozilla/sccache#2767)
- gcc: refine response-file tokenizer visibility and whitespace handling by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2772](mozilla/sccache#2772)
- Fix description of Unix socket-based Redis connection by [@&#8203;Toorero](https://github.com/Toorero) in [#&#8203;2769](mozilla/sccache#2769)

##### Cleanup

- Simplify the code from pr [#&#8203;2761](mozilla/sccache#2761) by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2774](mozilla/sccache#2774)
- tests: pin libc in the dist test crate by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2784](mozilla/sccache#2784)
- Release 0.17.0 by [@&#8203;sylvestre](https://github.com/sylvestre) in [#&#8203;2783](mozilla/sccache#2783)

##### New Contributors

- [@&#8203;jwidauer](https://github.com/jwidauer) made their first contribution in [#&#8203;2758](mozilla/sccache#2758)
- [@&#8203;jpadilla](https://github.com/jpadilla) made their first contribution in [#&#8203;2770](mozilla/sccache#2770)
- [@&#8203;ranger-ross](https://github.com/ranger-ross) made their first contribution in [#&#8203;2782](mozilla/sccache#2782)
- [@&#8203;Toorero](https://github.com/Toorero) made their first contribution in [#&#8203;2769](mozilla/sccache#2769)

**Full Changelog**: <mozilla/sccache@v0.16.0...v0.17.0>

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0My4yNTYuMCIsInVwZGF0ZWRJblZlciI6IjQzLjI1Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

---------

Co-authored-by: Renovate Bot <renovate@endsy.me>
Reviewed-on: https://gitea.endsy.me/op/red/pulls/24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ctrl-C leaving sccache compilations running

3 participants